package com.trkj.pojo;

import java.io.Serializable;
import javax.persistence.*;

import com.alibaba.fastjson.annotation.JSONField;

import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.List;


/**
 * The persistent class for the SALARY_ACCOUNT database table.
 * 
 */
@Entity
@Table(name="SALARY_ACCOUNT")
@NamedQuery(name="SalaryAccount.findAll", query="SELECT s FROM SalaryAccount s")
public class SalaryAccount implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(name="SALARY_ACCOUNT_ACCOUNTID_GENERATOR", sequenceName="HR")
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="SALARY_ACCOUNT_ACCOUNTID_GENERATOR")
	@Column(name="ACCOUNT_ID")
	private long accountId;
	@JSONField(format="yyyy-MM-dd HH:mm:ss")
	@Column(name="ACCOUNT_CREATORDATE")
	private Timestamp accountCreatordate;
	@JSONField(format="yyyy-MM-dd HH:mm:ss")
	@Column(name="ACCOUNT_ENDDATE")
	private Timestamp accountEnddate;

	@Column(name="ACCOUNT_NAME")
	private String accountName;

	@Column(name="ACCOUNT_NUMBER")
	private BigDecimal accountNumber;

	@Column(name="ACCOUNT_PERSON")
	private String accountPerson;

	@Column(name="ACCOUNT_REMARK")
	private String accountRemark;
	@JSONField(format="yyyy-MM-dd HH:mm:ss")
	@Column(name="ACCOUNT_STARTDATE")
	private Timestamp accountStartdate;

	//bi-directional many-to-one association to Salary
	@OneToMany(mappedBy="salaryAccount")
	@JSONField(serialize=false)
	private List<Salary> salaries;

	//bi-directional many-to-one association to ProjectTemplate
	@ManyToOne
	@JoinColumn(name="TEMPLATE_ID")
	private ProjectTemplate projectTemplate;

	//bi-directional many-to-one association to StaffInformation
	@OneToMany(mappedBy="salaryAccount")
	@JSONField(serialize=false)
	private List<StaffInformation> staffInformations;

	public SalaryAccount() {
	}

	public long getAccountId() {
		return this.accountId;
	}

	public void setAccountId(long accountId) {
		this.accountId = accountId;
	}

	public Timestamp getAccountCreatordate() {
		return this.accountCreatordate;
	}

	public void setAccountCreatordate(Timestamp accountCreatordate) {
		this.accountCreatordate = accountCreatordate;
	}

	public Timestamp getAccountEnddate() {
		return this.accountEnddate;
	}

	public void setAccountEnddate(Timestamp accountEnddate) {
		this.accountEnddate = accountEnddate;
	}

	public String getAccountName() {
		return this.accountName;
	}

	public void setAccountName(String accountName) {
		this.accountName = accountName;
	}

	public BigDecimal getAccountNumber() {
		return this.accountNumber;
	}

	public void setAccountNumber(BigDecimal accountNumber) {
		this.accountNumber = accountNumber;
	}

	public String getAccountPerson() {
		return this.accountPerson;
	}

	public void setAccountPerson(String accountPerson) {
		this.accountPerson = accountPerson;
	}

	public String getAccountRemark() {
		return this.accountRemark;
	}

	public void setAccountRemark(String accountRemark) {
		this.accountRemark = accountRemark;
	}

	public Timestamp getAccountStartdate() {
		return this.accountStartdate;
	}

	public void setAccountStartdate(Timestamp accountStartdate) {
		this.accountStartdate = accountStartdate;
	}

	public List<Salary> getSalaries() {
		return this.salaries;
	}

	public void setSalaries(List<Salary> salaries) {
		this.salaries = salaries;
	}

	public Salary addSalary(Salary salary) {
		getSalaries().add(salary);
		salary.setSalaryAccount(this);

		return salary;
	}

	public Salary removeSalary(Salary salary) {
		getSalaries().remove(salary);
		salary.setSalaryAccount(null);

		return salary;
	}

	public ProjectTemplate getProjectTemplate() {
		return this.projectTemplate;
	}

	public void setProjectTemplate(ProjectTemplate projectTemplate) {
		this.projectTemplate = projectTemplate;
	}

	public List<StaffInformation> getStaffInformations() {
		return this.staffInformations;
	}

	public void setStaffInformations(List<StaffInformation> staffInformations) {
		this.staffInformations = staffInformations;
	}

	public StaffInformation addStaffInformation(StaffInformation staffInformation) {
		getStaffInformations().add(staffInformation);
		staffInformation.setSalaryAccount(this);

		return staffInformation;
	}

	public StaffInformation removeStaffInformation(StaffInformation staffInformation) {
		getStaffInformations().remove(staffInformation);
		staffInformation.setSalaryAccount(null);

		return staffInformation;
	}

}